//
//  TJUserInfo.m
//  BaoDian
//
//  Created by mac on 2024/7/17.
//

#import "TJUserInfo.h"
 

#define UserDefaults [NSUserDefaults standardUserDefaults]


@implementation TJUserInfo

+ (void)setToken:(NSString *)token {
    [UserDefaults setValue:token forKey:user_token];
}

+ (NSString *)token {
    return [UserDefaults valueForKey:user_token];
}

+ (void)setUserId:(NSString *)userId {
    [UserDefaults setValue:userId forKey:user_Id];
}

+ (NSString *)userId {
    return [UserDefaults valueForKey:user_Id];
}

+ (void)setNo:(NSString *)no {
    [UserDefaults setValue:no forKey:user_no];
}

+ (NSString *)no {
    return [UserDefaults valueForKey:user_no];
}

+ (void)setIsLogin:(BOOL)isLogin {
    [UserDefaults setValue:@(isLogin) forKey:user_isLogin];
}

+ (BOOL)isLogin {
    return [[UserDefaults valueForKey:user_isLogin] boolValue];
}

+ (void)setAccount:(NSString *)account {
    if (![account isKindOfClass:NSString.class]) return;
    [UserDefaults setValue:account forKey:user_account];
}

+ (NSString *)account {
    return [UserDefaults valueForKey:user_account];
}
 

+ (void)setAvatar:(NSString *)avatar {
    [UserDefaults setValue:avatar forKey:user_avatar];
}

+ (NSString *)avatar {
    return [UserDefaults valueForKey:user_avatar];
}

+ (void)setAgreement:(NSString *)agreement {
    [UserDefaults setValue:agreement forKey:user_agreement];
}

+ (NSString *)agreement {
    return [UserDefaults valueForKey:user_agreement];
}

+ (void)setNickname:(NSString *)nickname {
    [UserDefaults setValue:nickname forKey:user_nickname];
}

+ (NSString *)nickname {
    return [UserDefaults valueForKey:user_nickname];
}

+ (void)setIsRememberPassword:(BOOL)isRememberPassword {
    [UserDefaults setValue:@(isRememberPassword) forKey:user_isRememberPassword];
}

+ (BOOL)isRememberPassword {
    return [[UserDefaults valueForKey:user_isRememberPassword] boolValue];
}

+ (void)setRefreshTokenDate:(NSString *)refreshTokenDate {
    [UserDefaults setValue:refreshTokenDate forKey:user_refreshTokenDate];
}

+ (NSString *)refreshTokenDate {
    return [UserDefaults valueForKey:user_refreshTokenDate];
}

+ (void)setShowUpdateDate:(NSString *)showUpdateDate {
    [UserDefaults setValue:showUpdateDate forKey:user_showUpdateDate];
}

+ (NSString *)showUpdateDate {
    return [UserDefaults valueForKey:user_showUpdateDate];
}

+ (void)setPhone:(NSString *)phone {
    [UserDefaults setValue:phone forKey:user_phone];
}

+ (NSString *)phone {
    return [UserDefaults valueForKey:user_phone];
}
+ (BOOL)isMerchant {
    return [[UserDefaults valueForKey:user_isMerchant] boolValue];
}

+ (void)setIsMerchant:(BOOL)isMerchant {
    [UserDefaults setValue:@(isMerchant) forKey:user_isMerchant];
}

+ (void)clear {
    [UserDefaults removeObjectForKey:user_isLogin];
    [UserDefaults removeObjectForKey:user_token];
    [UserDefaults removeObjectForKey:user_nickname];
    [UserDefaults removeObjectForKey:user_avatar];
    [UserDefaults removeObjectForKey:user_Id];
    [UserDefaults removeObjectForKey:user_refreshTokenDate];
    [UserDefaults removeObjectForKey:user_phone];
    [UserDefaults removeObjectForKey:user_isMerchant];
}
 

@end
